package com.hello.world.config;

import com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

@Configuration
@ImportResource(locations = { "classpath:META-INF/spring/*.xml" })//dubbo发布的接口
public class ServletConfig {

    //注册Servlet
    @Bean
    public ServletRegistrationBean myServlet(){
        // TODO 配置
        System.setProperty("dubbo.protocol.restful.contextpath","/dubboapi");
        return new ServletRegistrationBean(new DispatcherServlet(), "/dubboapi/*");
    }
}
